(use-modules
 ;; SRFI 64 for unit testing facilities
 (srfi srfi-64)
 ;; utils - the code to be tested
 (utils collections))


(test-begin "collection-utils-test")


(test-group
 "make-reducer"

 (test-equal "make reducer for lists - 1"
   6
   ((make-reducer car cdr null?) '(1 2 3) + 0))

 (test-equal "make reducer for lists - 2"
   10
   ((make-reducer car cdr null?) '(1 2 3 4) + 0))

 (test-equal "make reducer for lists - 3"
   11
   ((make-reducer car cdr null?) '(1 2 3 4) + 1))

 (test-equal "make reducer for lists - 4"
   6
   ((make-reducer car cdr null?) '(1 2 3) * 1))

 (test-equal "make reducer for lists - 5"
   24
   ((make-reducer car cdr null?) '(1 2 3 4) * 1)))


(test-end "collection-utils-test")
